from typing import List


class Solution:
    def xorGame(self, nums: List[int]) -> bool:
        ans = 0
        for num in nums:
            ans ^= num
        return ans == 0 or len(nums) % 2 == 0


if __name__ == "__main__":
    print(Solution().xorGame([1, 1, 2]))  # False
    print(Solution().xorGame([0, 1]))  # True
    print(Solution().xorGame([1, 1, 2, 3]))  # True

    # 测试用例155
    print(Solution().xorGame([1, 2, 3]))  # True
